<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>修改文章</title>
<!--公共样式开始-->
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/reset.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/common.css">
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Plugins/FontAwesome/css/font-awesome.min.css">
<!--公共样式结束-->
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/module_form.css">
<link rel="stylesheet" type="text/css" href="{$NOW_THEME_URL}/Assets/Css/page_memberAdd.css">
<!--核心JS插件开始-->
<script src="__PUBLIC__/Js/jquery.min.js"></script>
<script src="__PUBLIC__/Js/jquery.timer.js"></script>
<script src="{$NOW_THEME_URL}/Assets/Js/common.js"></script>
<!--核心JS插件结束-->
<!--Tab插件开始-->
<script src="__PUBLIC__/Plugins/Ettab/Js/ettab.js"></script>
<!--Tab插件结束-->
<!--富文本编辑器插件开始-->
<script type="text/javascript" src="__PUBLIC__/Plugins/Xheditor/xheditor-1.2.1.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/Plugins/Xheditor/xheditor_lang/{$Think.LANG_SET}.js"></script>
<!--富文本编辑器插件结束-->
<!--上传插件开始-->
<script type="text/javascript" src="__PUBLIC__/Plugins/Etfile/Js/etfile_use.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Plugins/Etfile/Css/etfile_use.css">
<!--上传插件结束-->
<!--表单验证插件开始-->
<script type="text/javascript" src="__PUBLIC__/Plugins/EtValid/JS/etvalid.js"></script>
<!--表单验证插件结束-->
</head>

<body>
	<div class="page_header">
		<div class="tabbar">
			<ul class="tab clearfix">
				<li class="tabhover" fortab="tab1" show="tab_1">基本信息</li>
				<li fortab="tab1" show="tab_2">详细内容</li>
				<!-- <li fortab="tab1" show="tab_3">图片信息</li> -->
			</ul>
		</div>
	</div>
	<form class="myForm" action="#" id="articleEdit_form">
	<div class="page_wraper">
		<div fortab="tab1" dosome="false" id="tab_1">
			<input type="hidden" name="solevar"  id="solevar"  value="{:create_id()}"/>
			<input type="hidden" name="id"  id="id"  value="{$detail.id}"/>
			<table cellpadding="0" cellspacing="0" class="module_form interlaceColor">
				{$detail.site|eleSiteShow=###}<!-- 多站点支持 -->
				{$detail.lang|eleLangShow=###}<!-- 多语言支持 -->
				{$detail.cateid|eleCateidShow=###}<!-- 所属栏目支持 -->
				<tr>
					<td class="ele_title"><label for="title">标题：<em>★</em></label></td>
					<td class="ele_content">
						<input value="{$detail.title}" name="title" type="text" id="title"  placeholder="文章标题不能为空" class="form_ele_text width_200 etvalid"
						datatype="*" msginfo="文章标题不能为空" msgerr="文章标题不能为空" msgok="请输入文章标题！" checkevent="focusout">
					</td>
					<td class="ele_tis">
						<div class="info">请输入标题</div>
					</td>
				</tr>
				<tr>
					<td class="ele_title"><label for="lang">审核状态：<i>☆</i></label></td>
					<td class="ele_content">
						<select name="checked" id="checked" class="form_ele_select width_200">
							<option value="">请选择</option>
							<option value="1" <eq name="detail.checked" value="1">selected</eq>>通过</option>
							<option value="2" <eq name="detail.checked" value="2">selected</eq>>未通过</option>
						</select>

					</td>
					<td class="ele_tis">
						<div class="info">请选择审核状态</div>
					</td>
				</tr>
				<tr>
					<td class="ele_title"><label for="writer">作者：<i>☆</i></label></td>
					<td class="ele_content">
						<input type="text" name="writer" value="{$detail.writer}" id="writer" placeholder="请输入文章作者" class="form_ele_text width_200">
					</td>
					<td class="ele_tis">
						<div class="info">请输入作者</div>
					</td>
				</tr>
				<tr>
					<td class="ele_title"><label for="sort">排序号：<i>☆</i></label></td>
					<td class="ele_content">
						<input type="text" name="sort" id="sort" class="form_ele_text width_200" placeholder="1">
					</td>
					<td class="ele_tis">
						<div class="info">请输入排序号</div>
					</td>
				</tr>
				<tr>
					<td class="ele_title"><label for="source">文章来源：<i>☆</i></label></td>
					<td class="ele_content">
						<input type="text" name="source" value="{$detail.source}" id="source" class="form_ele_text width_200" placeholder="请输入文章来源">
					</td>
					<td class="ele_tis">
						<div class="info">请输入文章来源</div>
					</td>
				</tr>
				<tr>
					<td class="ele_title"><label for="keywords">关键字：<em>★</em></label></td>
					<td class="ele_content">
						<input value="{$detail.keywords}" name="keywords" type="text" id="keywords" placeholder="请输入关键字" class="form_ele_text width_200 etvalid"
						datatype="*" msginfo="文章关键字不能为空" msgerr="文章关键字不能为空" msgok="请输入文章关键字！" checkevent="focusout">
					</td>
					<td class="ele_tis">
						<div class="info">多个关键词用空格分隔</div>
					</td>
				</tr>		
				<tr>
					<td colspan="3" class="bottom_space"></td>
				</tr>
			</table>
		</div>
		<div fortab="tab1" dosome="false" id="tab_2" style="display:none;">			
			<table cellpadding="0" cellspacing="0" class="module_form interlaceColor">

				<tr>
					<td class="ele_title"><label for="description">描述：<em>★</em></label></td>
					<td class="ele_content padding_10">
						<textarea name="description" class="form_ele_textarea etvalid"
						datatype="*" msginfo="文章描述不能为空" msgerr="文章描述不能为空" msgok="请输入文章描述！" checkevent="focusout"> {$detail.description} </textarea>
					</td>
					<td class="ele_tis">
						<div class="info">控制在70个字符以内</div>
					</td>
				</tr>		
				<tr>
					<td class="ele_title"><label for="content">文章内容：<em>★</em></label></td>
					<td class="ele_content padding_10 form_td_html" colspan="2">
						<textarea name="content" class="form_ele_html etvalid" style="width:680px;height:300px;"
						datatype="*" msginfo="文章内容不能为空" msgerr="文章内容不能为空" msgok="请输入内容标题！" checkevent="focusout"">{$detail.content}</textarea>
					</td>
				</tr>
				<!-- <tr>
					<td class="ele_title"><label for="static">开启静态：<i>☆</i></label></td>
					<td class="ele_content">
						<label for="device">
							<input value="1" class="form_ele_radio" type="radio" name="is_html" id="is_html" <eq name="detail.static" value="1">checked</eq>>
							开启
						</label>
						<label for="device">
							<input value="0" class="form_ele_radio" type="radio" name="is_html" id="is_html" <eq name="detail.static" value="2">checked</eq>>
							不开启
						</label>
					</td>
					<td class="ele_tis">
						<div class="info">开启将生成静态页面</div>
					</td>
				</tr>
				<tr>
					<td class="ele_title"><label for="html_url">页面地址：<i>☆</i></label></td>
					<td class="ele_content">
						<input value="" name="html_url" type="text" id="html_url" placeholder="请输入静态页面地址" class="form_ele_text width_200">
					</td>
					<td class="ele_tis">
						<div class="info">格式如：Folder/abc.html</div>
					</td>
				</tr> -->
				<tr>
					<td colspan="3" class="bottom_space">
					</td>
				</tr>
			</table>
		</div>
		<div fortab="tab1" dosome="false" id="tab_3" style="display:none;">			
			<table cellpadding="0" cellspacing="0" class="module_form interlaceColor">
				<tr>
					<td class="ele_title"><label>缩略图：<em>★</em></label></td>
					<td class="ele_content" colspan="2">
						<span class="et_upload_btn bg_green" id="upbtn_single"><i class="icon-picture"></i> 上传缩略图</span>
						<div id="uploadResult_single" class="et_file_list">
							<notempty  name="single">
							<dl class="etf_item">
								<dt>
									<img src="{$UPLOAD_PATH}{$single.fileurl}">
								</dt>
								<dd class="etf_item_text">
									<div class="input-prepend clearfix">
										<span class="add-on">S</span>
										<span class="add-input">
											<input type="text" value="{$single.sort}" name="single_sort[]">
										</span>
									</div>
									<div class="input-prepend clearfix">
									<span class="add-on">T</span>
									<span class="add-input">
										<input type="text" name="single_title[]" value="{$single.c_title}">
									</span></div><input type="hidden" value="{$single.fileurl}" name="single_url[]">
								</dd>
								<dd class="etf_item_tool">
									<span class="etf_item_see">
										<i class="icon-eye-open"></i>
									</span>
									<span class="etf_item_del">
										<i class="icon-remove-sign"></i>
									</span>
								</dd>
							</dl>
							</notempty>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="3" class="bottom_space">
					</td>
				</tr>
			</table>
		</div>
	</div>
	<div class="page_footer pdtd10">
		<input type="button" name="submit" id="submit" value="确  认"  class="form_ele_submit"/>
		<input type="reset" name="reset"   value="取  消"  class="form_ele_reset"/>
	</div>
	</form>
</body>
<script type="text/javascript">
	//弹出窗口全局变量
	$(function(){
		//实例化滑动门
		var tabConfig = {
				tabName: 'tab1',
				tabHeader: '.tab',
				tabContent: '.page_wraper',
				tabContentFun : {
				}
			};
		var tabObj = $('body').EtTab(tabConfig);
		
		//富文本编辑器
		$('textarea[name="content"]').xheditor({modalWidth:650,modalHeight:400,upBtnText:'上传文件',
			upLinkUrl:"!rest.php?s=FIL/Index/index&editor=ok",
			upImgUrl:"!rest.php?s=FIL/Index/index&editor=ok",
			upFlashUrl:"!rest.php?s=FIL/Index/index&editor=ok",
			upMediaUrl:"!rest.php?s=FIL/Index/index&editor=ok"}
		);
		
		
		//文件管理器上传
		window.upload_config = {};
		
		windowApi.dealSelectFile = function(data){
			etDealSelectFile(data,upload_config);
		}
		
		$('#upbtn_single').on('click',function(){
			upload_config.upload_field = 'single'; //上传的字段名
			upload_config.upload_box = 'uploadResult_single';  //文件显示位置
			upload_config.maxnum = 1;  //最大数量
			upload_config.cover = true;  //是否覆盖之前存在的
			
			var href = "rest.php?s=FIL/Index/index&islhgd=ok";
			var width = '900px';
			var height = '500px';
			var title = '上传缩略图';
			openDialog('uploadWindow',href,width,height,title);
		});
		
		
		//表单验证
		var formConfig = {};
		formConfig.submitSelector = '#submit';
		formConfig.dealSubmitMy = true;
		formConfig.dealSubmitOk = function(result){
			//console.log('ok');
			
			var tipsObj = windowApi.lhgdialog.tips('正在提交数据...',10,etIcon.loading);
			var postData = $('#articleEdit_form').serialize();
			$.post("{:U('Content/articleEdit')}", postData ,
				function(data){
					if(data.status == 1){
						tipsObj.close();
						windowApi.lhgdialog.tips('修改文章成功！',1,etIcon.success,function(){
							var obj = windowApi.lhgdialog.list['Content_article'];
							if(obj){
								obj.reload(obj);
							}else{
								var href   = "{:U('Content/article')}";
								openDialog('Content_article',href);
							}
							frameApi.close();
						});
					}else{
						windowApi.lhgdialog.tips(data.info);
					}
				}, "json"
			);
		}
		formConfig.dealSubmitErr = function(result){
			//console.log(result);
		}
		var validForm = $('.myForm').EtValid(formConfig);
		
	});
	//验证表单

</script>
</html>
